Make the new GtkAction code work with PolicyKit-gnome's use of actions.
authorMatthias Clasen <matthiasc@src.gnome.org>
Sat, 7 Feb 2009 03:17:43 +0000 (03:17 +0000)
committerMatthias Clasen <matthiasc@src.gnome.org>
Sat, 7 Feb 2009 03:17:43 +0000 (03:17 +0000)
        * gtk/gtkaction.c (gtk_action_[un]block_activate_from): Block
        the action.

        * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_activatable_reset):
        * gtk/gtktogglebutton. (gtk_toggle_button_activatable_reset):
        * gtk/gtktoggletoolbutton.c (gtk_toggle_tool_button_activatable_reset):
        Work with non-toggle actions without complaining.

        * gtk/gtktoolbutton.c (gtk_tool_button_activatable_update): Updating
        the icon-name should not remove the label.

        * gtk/gtkimagemenuitem.c (activatable_update_icon_name): Also
        update the image when the icon name is set to NULL.

svn path=/trunk/; revision=22290

ChangeLog
gtk/gtkaction.c
gtk/gtkcheckmenuitem.c
gtk/gtkimagemenuitem.c
gtk/gtktogglebutton.c
gtk/gtktoggletoolbutton.c
gtk/gtktoolbutton.c

index e75cad59925c91e597aec657db0d4c95edb20128..6855185c684c389cf0be4dfc84b3f919761c5b7d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,21 @@
+2009-02-06  Matthias Clasen  <mclasen@redhat.com>
+
+       Make the new GtkAction code work with PolicyKit-gnome's use of actions.
+
+       * gtk/gtkaction.c (gtk_action_[un]block_activate_from): Block
+       the action.
+
+       * gtk/gtkcheckmenuitem.c (gtk_check_menu_item_activatable_reset):
+       * gtk/gtktogglebutton. (gtk_toggle_button_activatable_reset):
+       * gtk/gtktoggletoolbutton.c (gtk_toggle_tool_button_activatable_reset):
+       Work with non-toggle actions without complaining.
+
+       * gtk/gtktoolbutton.c (gtk_tool_button_activatable_update): Updating
+       the icon-name should not remove the label.
+
+       * gtk/gtkimagemenuitem.c (activatable_update_icon_name): Also
+       update the image when the icon name is set to NULL.
+
 2009-02-06  Matthew Barnes  <mbarnes@redhat.com>
 
        * gtk/gtklabel.c (gtk_label_set_label): Accept a NULL string.
index 37f6e9254813ff37c444153ef143a787598571b4..f1e2788e086ca3455e5c0ac1157af21328c7b0e7 100644 (file)
@@ -1509,8 +1509,6 @@ gtk_action_set_icon_name (GtkAction   *action,
 
   g_return_if_fail (GTK_IS_ACTION (action));
 
-  g_return_if_fail (GTK_IS_ACTION (action));
-
   tmp = action->private_data->icon_name;
   action->private_data->icon_name = g_strdup (icon_name);
   g_free (tmp);
@@ -1604,6 +1602,8 @@ gtk_action_block_activate_from (GtkAction *action,
   
   g_signal_handlers_block_by_func (proxy, G_CALLBACK (gtk_action_activate),
                                   action);
+
+  gtk_action_block_activate (action);
 }
 
 /**
@@ -1630,6 +1630,8 @@ gtk_action_unblock_activate_from (GtkAction *action,
 
   g_signal_handlers_unblock_by_func (proxy, G_CALLBACK (gtk_action_activate),
                                     action);
+
+  gtk_action_unblock_activate (action);
 }
 
 static void
index e65370b0f14bb6fdfb77ba0f613534873813cb5f..1bfc26b7695a4c46dfc114e0da82459f0698cda9 100644 (file)
@@ -188,7 +188,7 @@ gtk_check_menu_item_activatable_reset (GtkActivatable       *activatable,
 
   parent_activatable_iface->reset (activatable, action);
 
-  if (!action)
+  if (!GTK_IS_TOGGLE_ACTION (action))
     return;
 
   gtk_action_block_activate (action);
index a7bc4299871a97590a348312095118d1c9d03954..04cc352ff81aa1a43e47978c9147a7e904c8b6c5 100644 (file)
@@ -601,7 +601,7 @@ activatable_update_icon_name (GtkImageMenuItem *image_menu_item, GtkAction *acti
 
   image = gtk_image_menu_item_get_image (image_menu_item);
          
-  if (GTK_IS_IMAGE (image) && icon_name &&
+  if (GTK_IS_IMAGE (image) && 
       (gtk_image_get_storage_type (GTK_IMAGE (image)) == GTK_IMAGE_EMPTY ||
        gtk_image_get_storage_type (GTK_IMAGE (image)) == GTK_IMAGE_ICON_NAME))
     {
index de6bb053e2915bfd28280466333e85656c04251c..6526f82fe2ac79a6cda1ed6a52c331388b53b57b 100644 (file)
@@ -188,7 +188,7 @@ gtk_toggle_button_activatable_reset (GtkActivatable   *activatable,
 
   parent_activatable_iface->reset (activatable, action);
 
-  if (!action)
+  if (!GTK_IS_TOGGLE_ACTION (action))
     return;
 
   button = GTK_TOGGLE_BUTTON (activatable);
index 062a2d0820a07781fb5de8c92d344b8bf65bfd50..4d1e2a9cfdb075a25f4c21a8499ad5458b9fcc7f 100644 (file)
@@ -346,7 +346,7 @@ gtk_toggle_tool_button_activatable_reset (GtkActivatable  *activatable,
 
   parent_activatable_iface->reset (activatable, action);
 
-  if (!action)
+  if (!GTK_IS_TOGGLE_ACTION (action))
     return;
 
   button = GTK_TOGGLE_TOOL_BUTTON (activatable);
index c99169a22ed30c31a7f8903f72772ec09c49cef0..2f7d8f1bf4688415463cbae9f85bea9d687c1228 100644 (file)
@@ -760,24 +760,9 @@ gtk_tool_button_activatable_update (GtkActivatable       *activatable,
   button = GTK_TOOL_BUTTON (activatable);
   
   if (strcmp (property_name, "short-label") == 0)
-    {
-      if (!gtk_action_get_stock_id (action) &&
-         !gtk_action_get_icon_name (action))
-       {
-         gtk_tool_button_set_use_underline (button, TRUE);
-         gtk_tool_button_set_label (button, gtk_action_get_short_label (action));
-       }
-    }
+    gtk_tool_button_set_label (button, gtk_action_get_short_label (action));
   else if (strcmp (property_name, "stock-id") == 0)
-    {
-      if (gtk_action_get_stock_id (action))
-       {       
-         gtk_tool_button_set_label (button, NULL);
-         gtk_tool_button_set_icon_name (button, NULL);
-       }
-      gtk_tool_button_set_icon_widget (button, NULL);
-      gtk_tool_button_set_stock_id (button, gtk_action_get_stock_id (action));
-    }
+    gtk_tool_button_set_stock_id (button, gtk_action_get_stock_id (action));
   else if (strcmp (property_name, "gicon") == 0)
     {
       const gchar *stock_id = gtk_action_get_stock_id (action);
@@ -800,14 +785,7 @@ gtk_tool_button_activatable_update (GtkActivatable       *activatable,
 
     }
   else if (strcmp (property_name, "icon-name") == 0)
-    {
-      if (gtk_action_get_icon_name (action))
-       {       
-         gtk_tool_button_set_label (button, NULL);
-         gtk_tool_button_set_stock_id (button, NULL);
-       }
-      gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action));
-    }
+    gtk_tool_button_set_icon_name (button, gtk_action_get_icon_name (action));
 }
 
 static void